In [1]:
    
import tensorflow as tf
import pandas as pd
import numpy as np
    
In [2]:
    
a = tf.constant([5,3], name="input_a")
b = tf.reduce_prod(a, name="prod_b")
c = tf.reduce_sum(a, name="sum_c")
d = tf.add(b,c, name="add_d")
    
In [5]:
    
sess = tf.Session()
sess.run(d)
    
    Out[5]:
In [4]:
    
sess.run(c)
    
    Out[4]:
In [5]:
    
output = sess.run(e)
    
In [7]:
    
writer = tf.train.SummaryWriter('./my_graph', sess.graph)
    
In [8]:
    
    
    
In [10]:
    
# Initialize some tensors to use in computation
a = np.array([2, 3], dtype=np.int32)
b = np.array([4, 5], dtype=np.int32)
#use tf.add() to init an 'add' operation
c = tf.add(a,b, name="fuck_add_jamal")
    
In [11]:
    
g = tf.Graph()
    
In [12]:
    
#You can then add Operations to it by using the Graph.as_default() method.
    
In [15]:
    
with g.as_default():
    #declare operations here like normal, and they'll be added to the graph, g.
    #Basically creates a local namespace for nodes.
    pass #passing so this cell will run
    
One can access the default graph (basically the global graph space) by just setting tf.get_default_graph() to a variable.
It is also possible to load in previously defined models from other TensorFlow scripts and assign them to Graph objects using a combo of the Graph.as_graph_def() and tf.import_graph_def() functions.
In [ ]: